
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>用户登陆</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
    <link rel="stylesheet" type="text/css" href="<%=basePath %>css/ext-all.css" />
    <script type="text/javascript" src="<%=basePath %>js/ext-base.js"></script>
     <script type="text/javascript" src="<%=basePath %>js/ext-all.js"></script>
  </head>
  
  <body>
  	<form action="LoginLogout.servlet?opt=login" method="post" name="frm" id="frm">
    <br>
		<table width="346" border="1" height="136" align="center">
			<tbody>
				 
				<tr align="center">
					<td>
						&nbsp;用户名：
					</td>
					<td align="left">
						&nbsp;
						<input type="text" name="loginName" id="loginName">
					</td>
				</tr>
				<tr>
					<td align="center">
						&nbsp;密&nbsp; 码：
					</td>
					<td>
						&nbsp;
						<input type="password" name="passWord" id="passWord">
					</td>
				</tr>
				<tr>
					 
					<td colspan="2" align="center">
						&nbsp;
						<input type="button" value="登陆" name="login" onclick="loginSubmit();">
						<input type="reset" value="重置" name="reset">
						<input type="reset" value="注册" name="reset">
					</td>
				</tr>
			</tbody>
		</table>
		<br>
		</form>
  </body>
</html>
<script type="text/javascript">
var submitIflag=false;
function loginSubmit(){
    var loginNameObj=document.getElementById("loginName");
    if(loginNameObj.value==""){
       Ext.MessageBox.show({
           title: '错误',
           msg: '用户名不能为空！',
           width: 250,
           buttons: Ext.MessageBox.OK,
           icon: Ext.MessageBox.ERROR
            });
          loginNameObj.select();
          loginNameObj.focus();
          return; 
    }
    
    
    var passWordObj=document.getElementById("passWord");
    if(passWordObj.value==""){
        Ext.MessageBox.show({
           title: '错误',
           msg: '密码不能为空！',
           width: 250,
           buttons: Ext.MessageBox.OK,
           icon: Ext.MessageBox.ERROR
            });
            
            passWordObj.select();
            passWordObj.focus();
           return;
    
    }
    

     submitIflag=true;
	var frm=document.getElementById("frm");
	frm.submit();
}

    /**回车键提交*/
    document.onkeydown = function(evt){ 
           var evt=window.event?window.event:evt;
           if (evt.keyCode==13){
            if(!submitIflag){//避免重复提交 
                loginSubmit();
            }
        }
    }

</script>
